﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Register.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            height: 20px;
        }
    </style>
    <script type="text/javascript">
        function BirthDay(pClientID)//生日用
        {
            var lUrl = 'MyBirthDay.aspx?DialogClientID=' + pClientID;
            window.open(lUrl, 'MyBirthDay', 'width=500,height=250');
        }
        var Bool = true;
          function CheckValue()
           {
            txt_UserName = document.getElementById("txtUserName");
            txt_BrithDay = document.getElementById("txtBrithDay");
            txtNickName = document.getElementById("txtNickName");
            txtPassword = document.getElementById("txtPassword");
            txtAgainPassword = document.getElementById("txtAgainPassword");
            txtEmail = document.getElementById("txtEmail");
            txtCellPhone = document.getElementById("txtCellPhone");
            drop_Favorite = document.getElementById("drop_Favorite");
            chk_Man = document.getElementById("chk_Man");
            chk_WoMan = document.getElementById("chk_WoMan");

              var ar = new Array(9);
              ar[0] = txt_UserName;
              ar[1] = txt_BrithDay;
              ar[2] = txtNickName;
              ar[3] = txtPassword;
              ar[4] = txtAgainPassword;
              ar[5] = txtEmail;
              ar[6] = txtCellPhone;
              ar[7] = drop_Favorite;
              ar[8] = chk_Man;
              ar[9] = chk_WoMan;
              for (var s = 0; s < ar.length; s++)
               {
                      if (ar[s].value =="") {
                          alert(ar[s].id + "\t" + "未填值");
                          return Bool = false;
                     }
                }
          }


          function ClearValue() {      
              txt_UserName = document.getElementById("txtUserName");
              txt_BrithDay = document.getElementById("txtBrithDay");
              txtNickName = document.getElementById("txtNickName");
              txtPassword = document.getElementById("txtPassword");
              txtAgainPassword = document.getElementById("txtAgainPassword");
              txtEmail = document.getElementById("txtEmail");
              txtCellPhone = document.getElementById("txtCellPhone");
              drop_Favorite = document.getElementById("drop_Favorite");
              txt_Constellation = document.getElementById("txt_Constellation");
              //chk_sex = document.getElementById("chk_Sex");
              chk_Man = document.getElementById("chk_Man");
              chk_WoMan = document.getElementById("chk_WoMan");

              var ar = new Array(10);
              ar[0] = txt_UserName;
              ar[1] = txt_BrithDay;
              ar[2] = txtNickName;
              ar[3] = txtPassword;
              ar[4] = txtAgainPassword;
              ar[5] = txtEmail;
              ar[6] = txtCellPhone;
              ar[7] = drop_Favorite;
              ar[8] = txt_Constellation;
              ar[9] = chk_Man;
              ar[10] = chk_WoMan;
              for (var s = 0; s < ar.length; s++) {
                  ar[s].value = "";
              }
               
          }







        function xingzuo() {
            //var start = 1901, date = document.getElementById("txtDay").value, month = document.getElementById("txtMonth").value; ;
            var start = 1901, date = document.getElementById("txtBrithDay").value, month = document.getElementById("txtBrithDay").value;
//            date = "2012/01/20";
//            alert(date.substr(5,2));
            with (document.getElementById("txt_Constellation")) {
                if (month.substr(5,2) == 1 && date.substr(8,2) >= 20 || month.substr(5,2).substr(5,2) == 2 && date.substr(8,2) <= 18) { value = "水瓶座"; }
                if (month.substr(5,2) == 1 && date > 31) { value = "Huh?"; }
                if (month.substr(5, 2).substr(5, 2) == 2 && date >= 19 || month.substr(5, 2) == 3 && date.substr(8, 2) <= 20) { value = "双鱼座"; }
                if (month.substr(5,2) == 2 && date.substr(8,2) > 29) { value = "Say what?"; }
                if (month.substr(5,2) == 3 && date.substr(8,2) >= 21 || month.substr(5,2) == 4 && date.substr(8,2) <= 19) { value = "白羊座"; }
                if (month.substr(5,2) == 3 && date.substr(8,2) > 31) { value = "OK. Whatever."; }
                if (month.substr(5,2) == 4 && date.substr(8,2) >= 20 || month.substr(5,2) == 5 && date.substr(8,2) <= 20) { value = "金牛座"; }
                if (month.substr(5,2) == 4 && date.substr(8,2) > 30) { value = "I'm soooo sorry!"; }
                if (month.substr(5,2) == 5 && date.substr(8,2) >= 21 || month.substr(5,2) == 6 && date.substr(8,2) <= 21) { value = "双子座"; }
                if (month.substr(5,2) == 5 && date.substr(8,2) > 31) { value = "Umm ... no."; }
                if (month.substr(5,2) == 6 && date.substr(8,2) >= 22 || month.substr(5,2) == 7 && date.substr(8,2) <= 22) { value = "巨蟹座"; }
                if (month.substr(5,2) == 6 && date.substr(8,2) > 30) { value = "Sorry."; }
                if (month.substr(5,2) == 7 && date.substr(8,2) >= 23 || month.substr(5,2) == 8 && date.substr(8,2) <= 22) { value = "狮子座"; }
                if (month.substr(5,2) == 7 && date.substr(8,2) > 31) { value = "Excuse me?"; }
                if (month.substr(5,2) == 8 && date.substr(8,2) >= 23 || month.substr(5,2) == 9 && date.substr(8,2) <= 22) { value = "室女座"; }
                if (month.substr(5,2) == 8 && date.substr(8,2) > 31) { value = "Yeah. Right."; }
                if (month.substr(5,2) == 9 && date.substr(8,2) >= 23 || month.substr(5,2) == 10 && date.substr(8,2) <= 22) { value = "天秤座"; }
                if (month.substr(5,2) == 9 && date.substr(8,2) > 30) { value = "Try Again."; }
                if (month.substr(5,2) == 10 && date.substr(8,2) >= 23 || month.substr(5,2) == 11 && date.substr(8,2) <= 21) { value = "天蝎座"; }
                if (month.substr(5,2) == 10 && date.substr(8,2) > 31) { value = "Forget it!"; }
                if (month.substr(5,2) == 11 && date.substr(8,2) >= 22 || month.substr(5,2) == 12 && date.substr(8,2) <= 21) { value = "人马座"; }
                if (month.substr(5,2) == 11 && date.substr(8,2) > 30) { value = "Invalid date.substr(8,2)"; }
                if (month.substr(5,2) == 12 && date.substr(8,2) >= 22 || month.substr(5,2) == 1 && date.substr(8,2) <= 19) { value = "摩羯座"; }
                if (month.substr(5,2) == 12 && date.substr(8,2) > 31) { value = "No way!"; }
            }
        }
//        function IsNull() {
//            var txtBirthDay = document.getElementById("txtBrithDay");
//            while (txtBirthDay.value !=BirthDay) {
//                xingzuo();
//            }
//            
//        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table  id="TwNf_Register"  align="center" 
        
            style="padding: inherit; margin: inherit; border-style: inset; border-width: inherit; width:500px; table-layout: inherit; border-collapse: inherit; border-spacing: inherit; empty-cells: inherit; caption-side: inherit; line-height: inherit;">
   <tr><td colspan="2" align="center">
       <asp:Label ID="lblRegister" runat="server" Text="註冊成為會員"></asp:Label>
       </td></tr>
      <tr ><td class="style2">
       <asp:Label ID="lblId" runat="server" Text="流水號" Visible="False"></asp:Label></td><td>
              <asp:Label ID="Label15" runat="server" Text=""></asp:Label>
          </td></tr>
   <tr><td class="style2">
       <asp:Label ID="lblUserName" runat="server" Text="本名"></asp:Label>
       </td><td>
           <asp:TextBox ID="txtUserName" runat="server"  onmousemove ="xingzuo()"></asp:TextBox>
       </td></tr>
   <tr><td class="style2">
       <asp:Label ID="lblNickName" runat="server" Text="暱稱"></asp:Label>
       </td><td>
           <asp:TextBox ID="txtNickName" runat="server"  onmousemove ="xingzuo()"></asp:TextBox>
       </td></tr>
      <tr><td class="style1">
          <asp:Label ID="lblSex" runat="server" Text="性別"></asp:Label>
          </td><td style="align:center" align="left">
              <asp:CheckBox ID="chk_Man" runat="server"  Text="男" />
              <asp:CheckBox ID="chk_WoMan" runat="server"  Text="女"/>
          </td></tr>
   <tr><td class="style2">
       <asp:Label ID="lblPassword" runat="server" Text="密碼"></asp:Label>
       </td><td>
           <asp:TextBox ID="txtPassword" runat="server"  onmousemove ="xingzuo()"></asp:TextBox>
       </td></tr>
   <tr><td class="style2">
       <asp:Label ID="lblAgainPassword" runat="server" Text="再輸入一次密碼"></asp:Label>
       </td><td>
           <asp:TextBox ID="txtAgainPassword" runat="server"  onmousemove ="xingzuo()"></asp:TextBox>
       </td></tr>
      <tr><td class="style2">
          <asp:Label ID="lblEmail" runat="server" Text="電子郵件"></asp:Label>
          </td><td>
              <asp:TextBox ID="txtEmail" runat="server"  onmousemove ="xingzuo()"></asp:TextBox>
          </td></tr>
   <tr><td class="style2">
       <asp:Label ID="lblCellPhone" runat="server" Text="手機"></asp:Label>
       </td><td>
           <asp:TextBox ID="txtCellPhone" runat="server"  onmousemove ="xingzuo()"></asp:TextBox>
       </td></tr>
   <tr><td class="style2">
       <asp:Label ID="lblBirthDay" runat="server" Text="生日"></asp:Label> </td>
     <td>
     <input type="text" id="txtBrithDay" onclick="BirthDay(this.id)"   onmousemove ="xingzuo()"  runat="server"  />&nbsp;&nbsp;
     </td>
     </tr>

      <%--<td><input type="text" id="txtBrithDay" onclick="BirthDay(this.id)"  runat="server"  /><input type="text"  runat="server" id="txtMonth"value="" /><input  type="text" runat="server"  id="txtDate" value="" /> </td></tr>--%>
   <%--    </td><td><input type="text" id="txtMonth" onclick="BirthDay(this.id)"  runat="server"  /></td></tr>--%>
   <tr><td class="style1">
       <asp:Label ID="lblConstellation" runat="server" Text="星座"></asp:Label>
       </td><td class="style1">
           <asp:TextBox ID="txt_Constellation" runat="server"  AutoPostBack="false"></asp:TextBox>
             </td></tr>
   <tr><td class="style2">
       <asp:Label ID="lblFavorite" runat="server" Text="我的最愛"></asp:Label>
       </td><td>
           <asp:DropDownList ID="drop_Favorite" runat="server" DataTextField="Favorite">
           </asp:DropDownList>
       </td></tr>
   <tr><td class="style2">
       <asp:Label ID="Label12" runat="server" Text="Label"></asp:Label>
       </td><td></td></tr>
   <tr><td class="style2">
       <asp:Label ID="Label13" runat="server" Text="Label"></asp:Label>
       </td><td></td></tr>
   <tr><td class="style2">
       <asp:Label ID="lblRegister_Button" runat="server" Text="註冊"></asp:Label></td><td>
           <asp:Button ID="btn_Register" runat="server" Text="註冊" Width="150px"  OnClientClick="Bool=CheckValue();return Bool"
               onclick="Button1_Click" />
           <asp:Button ID="btn_Clear" runat="server" Text="清除" Width="150px" 
               onclick="Button_Click" OnClientClick="ClearValue()" />
              </td></tr>
   </table>
    </div>
 
    </form>
    <script type="text/javascript">
        function ShowMy() {
            var txtBrithDay = document.getElementById("txtBrithDay");
            var s = "123";
            alert(s.substring(0,2));
            if(txtBrithDay.value!=null)
            {
                alert("a");
            }
        }


        function dateToString(dt) {
            var h = dt.getHours();
            var m = dt.getMinutes();
            var s = dt.getSeconds();

            // ensure there are always at least two characters 
            h = ('0' + h).substring(h.toString().length - 2);
            m = ('0' + m).substring(m.toString().length - 2);
            s = ('0' + s).substring(s.toString().length - 2);
            
            return h + ':' + m + ':' + s;
        } 

    </script>
</body>
</html>
